import javafx.application.Application;
import javafx.geometry.HPos;
import javafx.geometry.Insets;
import javafx.geometry.Pos;
import javafx.scene.Scene;
import javafx.scene.control.Button;
import javafx.scene.control.Label;
import javafx.scene.control.TextField;
import javafx.scene.layout.GridPane;
import javafx.stage.Stage;



public class Main extends Application {

    @Override
    public void start(Stage primaryStage) throws Exception {
        GridPane pane = new GridPane();
        pane.setAlignment(Pos.BASELINE_CENTER);//对齐
        pane.setPadding(new Insets(12,13,14,15));//设置上右下左的pixels
        //pane.setGridLinesVisible(true);
        pane.setHgap(10);
        pane.setVgap(10);

        /*将节点放入pane中*/
        pane.add(new Label("First name:"), 0, 0);
        pane.add(new TextField(), 1,0);
        Label mi = new Label("MI:");
        pane.add(mi, 0,1);
        GridPane.setHalignment(mi, HPos.RIGHT);//控件在单元格的对齐方式
        pane.add(new TextField(), 1,1);
        pane.add(new Label("Last name:"), 0,2);
        pane.add(new TextField(), 1,2);
        Button add=new Button("Add name");
        pane.add(add, 1,3);
        GridPane.setHalignment(add, HPos.RIGHT);
        /*创建一个scene将pane放入stage中*/
        Scene scene = new Scene(pane);

        primaryStage.setTitle("show FlowPane");
        primaryStage.setScene(scene);
        primaryStage.show();

    }

    /*public static void main(String[] args) {
        Application.launch(args);
    }*/
}